package com.weishu.banking.controller;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.weishu.common.core.web.domain.AjaxResult;
import com.weishu.core.caiwu.*;
import com.weishu.core.entity.SysRegion;
import com.weishu.core.mapper.CwCztxApplyMapper;
import com.weishu.core.service.ICwCztxApplyService;
import com.weishu.core.service.ICwHailianDealPerDayService;
import com.weishu.core.service.ISysRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;

@RestController
@RequestMapping("per")
public class BankingDealPerDayController {

    /**
     * 收入统计 查询分页
     */
    @Autowired
    private ICwHailianDealPerDayService iCwHailianDealPerDayService;
    /**
     * 支出统计 查询分页
     */
    @Resource
    private CwCztxApplyMapper cwCztxApplyMapper;
    /**
     * 城市调用方法
     */
    @Autowired
    private ISysRegionService iSysRegionService;


    /**
     * 维数财务报表查询总计
     * @param param
     * @return
     */
    @RequestMapping("sumlist")
    public AjaxResult DealPerSerchSunm(HaiLianIncomePage param){
        CwDealPerDayTotalDto cwDealPerDayTotalDto = iCwHailianDealPerDayService.searchHaiLianIncomeSum(param);
        return  AjaxResult.success(cwDealPerDayTotalDto);
    }

    /**
     * 维数财务报表统计数据
     */
    @RequestMapping("searchlist")
    public AjaxResult DealPerSerch(Integer pageNo,Integer pageSize,HaiLianIncomePage param){
        PageHelper.startPage(pageNo, pageSize);
        List<CwDealPerDayDto> cwDealPerDayDtos = iCwHailianDealPerDayService.searchHaiLianIncomePage(param);

        PageInfo<CwDealPerDayDto> info=new PageInfo<>(cwDealPerDayDtos);
        return AjaxResult.success(info);
    }

    /**
     * 支出总计
     * @param param
     * @return
     */
    @RequestMapping("sumlistzhi")
    public AjaxResult DealPerZhiSum(HaiLianPayDetailPage param){
        BigDecimal txSum = cwCztxApplyMapper.getTxSum(param);
        return  AjaxResult.success(txSum);
    }

    /**
     * 支出总计明细
     * @param param
     * @return
     */
    @RequestMapping("listzhi")
    public AjaxResult DealPerZhiSum(Integer pageNum,Integer pageSize2,HaiLianPayDetailPage param){
        PageHelper.startPage(pageNum, pageSize2);
        List<HaiLianPayDetailDto> haiLianPayDetailDtos = cwCztxApplyMapper.selectTxPerDay(param);
        PageInfo<HaiLianPayDetailDto> info=new PageInfo<>(haiLianPayDetailDtos);
        return  AjaxResult.success(info);
    }
    /**
     * 查询条件地区
     */
    @RequestMapping("citylist")
    public AjaxResult CityList(){
        List<SysRegion> sheng = iSysRegionService.getsheng();
        return AjaxResult.success(sheng);
    }



}
